package com.pearadmin.pro.modules.stu.rest;

import com.pearadmin.pro.modules.stu.domain.StuBusp;
import com.pearadmin.pro.common.aop.annotation.Log;
import com.pearadmin.pro.common.constant.ControllerConstant;
import com.pearadmin.pro.common.web.base.BaseController;
import com.pearadmin.pro.common.web.domain.Result;
import  com.pearadmin.pro.modules.stu.domain.StuBusp;
import com.pearadmin.pro.modules.stu.domain.StuRemind;
import  com.pearadmin.pro.modules.stu.param.StuBuspRequest;
import com.pearadmin.pro.modules.stu.param.StuPurposeRequest;
import  com.pearadmin.pro.modules.stu.service.StuBuspService;
import com.pearadmin.pro.modules.stu.service.StuPurposeService;
import com.pearadmin.pro.modules.stu.service.StuRemindService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * 商机管理-学生信息Controller
 *
 * @author chenJian
 * @date 2021-09-09
 */
@Api(tags = {"商机管理"})
@RestController
@RequestMapping(ControllerConstant.ADMIN+"stu/stuBusp")
public class StuBuspController extends BaseController
{
    @Resource
    private StuBuspService stuBuspService;
    @Resource
    private StuRemindService stuRemindService;
    @Resource
    private StuPurposeService stuPurposeService;


    /**
     * 新增保存商机管理-学生信息
     * @param stuBusp 查询参数
     * @return {@link Result}
     */
    @PostMapping("/save")
    @Log(title = "新增商机管理")
    @ApiOperation(value = "新增商机管理")
    public Result save(@RequestBody StuBusp stuBusp)
    {
        return auto(stuBuspService.stuSaveOrUpdate(stuBusp));
    }

    /**
     * 查询商机管理-学生信息详情
     *
     * @param id 商机管理-学生信息ID
     * @return 商机管理-学生信息
     */
    @GetMapping("/selectById")
    @Log(title = "查询商机管理详情")
    @ApiOperation(value = "查询商机管理详情")
    public Result<StuBusp> selectById(@RequestParam Long id)
    {
        return success(stuBuspService.selectStuBuspById(id));
    }

    /**
     * 查询商机管理-学生信息列表
     *  @param request 查询参数
     *  @return {@link Result}
     */
    @GetMapping("/page")
    @Log(title = "商机管理列表")
    @ApiOperation(value = "商机管理列表")
    public Result<StuBusp> list(StuBuspRequest stuBuspRequest)
    {
        return success(stuBuspService.page(stuBuspRequest));
    }

    /**
     * 修改保存商机管理-学生信息
     * @param stuBusp 查询参数
     * @return {@link Result}
     */
    @PutMapping("/update")
    @Log(title = "修改商机管理信息")
    @ApiOperation(value = "修改商机管理信息")
    public Result update(@RequestBody StuBusp stuBusp)
    {
        return auto(stuBuspService.stuSaveOrUpdate(stuBusp));
    }

    /**
     * 删除保存商机管理-学生信息
     * @param id 查询参数
     * @return {@link Result}
     */
    @DeleteMapping("/remove")
    @Log(title = "删除商机管理-学生信息")
    @ApiOperation(value = "删除商机管理-学生信息")
    public Result remove(@RequestParam Long id)
    {
        return auto(stuBuspService.removeById(id));
    }

    /**
    * 批量删除商机管理-学生信息
    * @param ids 批量删除
    * @return {@link Result}
    */
    @DeleteMapping("removeBatch")
    @Log(title = "批量删除商机管理-学生信息")
    @ApiOperation(value = "批量删除商机管理-学生信息")
    public Result removeBatch(@RequestParam List<Long> ids){
        return auto(stuBuspService.removeByIds(ids));
    }


}
